using Microsoft.EntityFrameworkCore;
using Admin3000.Backend.Api.Entity;

namespace Admin3000.Backend.Api.Database
{
    /// <summary>
    /// 数据库上下文，这里定义这些实体对应的数据表、及连接参数
    /// </summary>
    public class Admin3000Db : DbContext
    {
        /// <summary>
        /// 采用依赖注入的方式的时，必须提供其构造函数，并且调用其父类构造函数
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public Admin3000Db(DbContextOptions options) : base(options)
        {

        }
        public DbSet<Users> Users { get; set; }
        public DbSet<Roles> Roles { get; set; }
        public DbSet<UserRoles> UserRoles { get; set; }
        public DbSet<AuditInfo> AuditInfo { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder options)
        {
            options.UseSqlServer(@"server=.;database=Admin3000;uid=sa;pwd=123456;");
        }
    }
}